<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
</head>
<body>	
	<script type="text/javascript">
		var dataGrid;
		$(function() {
			dataGrid = $('#dataGrid').datagrid({
				url : '${pageContext.request.contextPath}/business/accounting/pingzhengcx/dataGrid.shtml',
				fit : true,
				border : false,
				pagination : true,
				pageSize : 10,
				pageList : [ 10, 20, 30, 40, 50 ],
				sortName : 'ID',
				sortOrder : 'ASC',
				checkOnSelect : false,
				selectOnCheck : false,
				nowrap : false,
				striped : true,
				rownumbers : true,
				singleSelect : false,
				columns : [ [{
					field : 'ID',
					width : 100,
					checkbox:true,
				},{
					field : 'ZHAIYAO',
					title : '摘要',
					width : 100,
					hidden : true
				},{
					field : 'YWLX',
					title : '业务类型',
					width : 100,
					sortable : true
				},{
					field : 'JFFSE',
					title : '借方发生额',
					width : 100,
					sortable : true
				}, {
					field : 'DFFSE',
					title : '贷方发生额',
					width : 100,
					sortable : true
				}, {
					field : 'FJDJS',
					title : '附件单据数',
					width : 100,
					sortable : true
				}, {
					field : 'PZRQ',
					title : '凭证日期',
					width : 100,
					sortable : true
				}, {
					field : 'ZD',
					title : '制单',
					width : 100,
					sortable : true
				}
				, {
					field : 'FH',
					title : '复核',
					width : 100,
					sortable : true
				}
				, {
					field : 'JZ',
					title : '记账',
					width : 100,
					sortable : true
				},{
					field : 'JZRQ',
					title : '记账日期',
					width : 100,
					sortable : true
				}
				, {
					field : 'PZZT',
					title : '凭证状态',
					width : 100,
					sortable : true
				}
				, {
					field : 'HZPZH',
					title : '汇总凭证号',
					width : 100,
					sortable : true
				},{
					field : 'XSPZH',
					title : '显示凭证号',
					width : 100,
					sortable : true
				}, {
					field : 'PZLB',
					title : '凭证类别',
					width : 100,
					sortable : true
				}, {
					field : 'action',
					title : '操作',
					width : 100,
					formatter : function(value, row, index) {
						var str = '';
							str += $.formatString('<a onclick="chakan(\'{0}\',\'{1}\');" src="{2}" > 查看</a>',row.XSPZH,row.JZRQ);
							str += $.formatString('<a onclick="shangchuan(\'{0}\',\'{1}\');" src="{2}" > 上传</a>',row.ID);
							str += $.formatString('<a onclick="shuju(\'{0}\',\'{1}\');" src="{2}" > 数据</a>',row.ID);
						return str;
					}
				}
				]],
				toolbar : '#toolbar',
				onLoadSuccess : function() {
					$('#pzcxsearchForm table').show();
					parent.$.messager.progress('close');
					$(this).datagrid('tooltip');
				},
				onRowContextMenu : function(e, rowIndex, rowData) {
					e.preventDefault();
					$(this).datagrid('unselectAll');
					$(this).datagrid('selectRow', rowIndex);
					$('#menu').menu('show', {
						left : e.pageX,
						top : e.pageY
					});
				}
			});
			
			console.info(dataGrid);
			dataGrid.datagrid('resize');
		});
		
		$('#PZLB').combobox({
			url:'${pageContext.request.contextPath}/business/accounting/pingzhengcx/pzlb.shtml',
		    valueField:'PZLB',
		    textField:'PZLB'
		});
		
		$('#YWLX').combobox({
			url:'${pageContext.request.contextPath}/business/accounting/pingzhengcx/ywlx.shtml',
		    valueField:'YWLX',
		    textField:'YWLX'
		});
		
		$('#ZD').combobox({
			url:'${pageContext.request.contextPath}/business/accounting/pingzhengcx/zd.shtml',
		    valueField:'ZD',
		    textField:'ZD'
		});
		
		$('#FH').combobox({
			url:'${pageContext.request.contextPath}/business/accounting/pingzhengcx/fh.shtml',
		    valueField:'FH',
		    textField:'FH'
		});
		
		 var year;
		 var month;
		 var endyear;
		 var endmonth;
 		$('#dd').datebox({
 			onSelect: function(date){
 				var tempyear=(date.getFullYear());
 				var tempmonth=(date.getMonth());
 				 year=tempyear;
 				 month=tempmonth;
 			}
 		});
 		$('#ddd').datebox({
 			onSelect: function(date){
 				var tempyear=(date.getFullYear());
 				var tempmonth=(date.getMonth());
 				endyear=tempyear;
 				endmonth=tempmonth;
 			}
 		});
 		
        function choose(){
 			
        	document.getElementById("PZBH").readOnly = true;
			document.getElementById("PZBH1").readOnly = true;
			document.getElementById('PZBH').style.backgroundColor = '#A1A1A1'; 
			document.getElementById('PZBH1').style.backgroundColor = '#A1A1A1'; 
 		}
 			
        	function chakan(XSPZH,JZRQ){
				 $('#ck_ck_window').window({
					    title:'记账凭证',
					    width:1050,
					    height:500,
					    href : '${pageContext.request.contextPath}/business/accounting/pingzhengcx/viewPage.shtml?XSPZH='+XSPZH+'&JZRQ='+JZRQ,
					    modal:true
					});
				 
			}
        
       function shangchuan(){
 			
    	   $('#up_ck_window').window({
    		    title:'附件单据上传',
			    width:1050,
			    height:500,
			    href : '${pageContext.request.contextPath}/business/accounting/pingzhengcx/shangchuanPagePage.shtml',
			    modal:true
			});
 		}
  
       function shuju(){
		
	}
 		
 		function errortime(){
 			
 			$('#ddd').datetimebox('setText', '0000-00-00');
 			$('#dd').datetimebox('setText', '0000-00-00');
 		}
 		
 		function searchFun() {
			if(year!=endyear){
				alert("请选择同一年度！");
				errortime();
				
			}else{
				if(month!=endmonth){
					 choose();
					 dataGrid.datagrid('load', $.serializeObject($('#pzcxsearchForm')));
				}else{
					dataGrid.datagrid('load', $.serializeObject($('#pzcxsearchForm')));
				}
			}
		}
 		
 		function cleanFun() {
			$('#pzcxsearchForm input').val('');
			dataGrid.datagrid('load', {});
		}
 		
	</script>
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',title:'',border:false" style="height: 100px; overflow: hidden;" >
			<form id="pzcxsearchForm">
				<table class="form_view_border" bordercolordark="#FFFFFF" bordercolorlight="#45b97c" border="px" cellpadding="0" cellspacing="0" style="">
					<tr>
						<th class="panel-header">凭证类别</th>
						<td >               
                                <input class="easyui-combobox" id="PZLB" name = "PZLB_EQ_STR" style="width: 194px;height: 27px;" data-options="valueField:'PZLB', textField:'PZLB', panelHeight:'auto'" >  
                            </td>
						<th class="panel-header">全选范围</th>
						<td><select  id="addcourseTypName" name="QXFW"  style="width: 194px;height: 27px;"
						data-options="required: true, editable: false"
						> 
							<option value="1">全部页</option>
							<option value="2">当前页</option>
							</select></td>
							<th class="panel-header">凭证日期</th>
						<td><input id="dd"  name="PZRQ_START_DATE_yyyyMMdd"
										class="form_view_input combo easyui-datebox" style="width:194px;height:27px;" data-options="editable:false"/>  </td>
						<th class="panel-header">至</th>
						<td><input id="ddd"  name="PZRQ_END_DATE_yyyyMMdd"
										class="form_view_input combo easyui-datebox" style="width:194px;height:27px;" data-options="editable:false"/>  </td>
					</tr>
					<tr>
					<th class="panel-header">制单人</th>
						<td >               
                                <input class="easyui-combobox" id="ZD" name = "ZD_EQ_STR" style="width: 194px;height: 27px;" data-options="valueField:'ZD', textField:'ZD', panelHeight:'auto'" >  
                            </td>
					<th class="panel-header">凭证摘要</th>
							<td style="width: 190px">               
                                <input class="easyui-textbox style_input" name = "ZHAIYAO" style="width:190px;height:27px;" >  
                            </td>
                    <th class="panel-header">凭证编号</th>
							<td style="width: 190px">               
                                <input class="easyui-textbox style_input" id="PZBH" name = "PZBH_START_STR"  style="width:190px;height:27px;" >  
                            </td>
                    <th class="panel-header">至</th>
							<td style="width: 190px">               
                                <input class="easyui-textbox style_input" id="PZBH1" name = "PZBH_END_STR"   style="width:190px;height:27px;" >  
                            </td>
					</tr>
					<tr>
					<th class="panel-header">业务类型</th>
						<td >               
                                <input class="easyui-combobox" id="YWLX" name = "YWLX_EQ_STR" style="width: 194px;height: 27px;" data-options="valueField:'YWLX', textField:'YWLX', panelHeight:'auto'" >  
                            </td>
					<th class="panel-header">复核人</th>
						<td >               
                                <input class="easyui-combobox" id="FH" name = "FH_EQ_STR" style="width: 194px;height: 27px;" data-options="valueField:'FH', textField:'FH', panelHeight:'auto'" >  
                            </td>
					<th class="panel-header">凭证金额</th>
							<td style="width: 190px">               
                                <input name = "JFFSE_START_STR" style="width:190px;height:27px;" >  
                            </td>
                    <th class="panel-header">至</th>
							<td style="width: 190px">               
                                <input name = "JFFSE_END_STR" style="width:190px;height:27px;" >  
                            </td>
					</tr>
				</table>
			</form>
		</div>
		<div data-options="region:'center',border:false">
			<table id="dataGrid"></table>
		</div>
	</div>
	<div id="toolbar" style="display: none;">
		    <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'brick_add',plain:true" onclick="searchFun();">查询</a>
		    <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'brick_delete',plain:true" onclick="cleanFun();">重置</a>
	</div>
<div id="ck_ck_window"></div>
<div id="up_ck_window"></div>
</body>
</html>
